package cn.schoolwow.workflow.entity;

import cn.schoolwow.quickdao.annotation.*;
import com.alibaba.fastjson.JSONObject;

import java.time.LocalDateTime;

@Comment("工作流实例")
public class WorkFlowInstance {
    @Id
    private long id;

    @Comment("关联工作流定义")
    @ForeignKey(table = WorkFlowDefinition.class)
    @Constraint(notNull = true)
    private long definitionId;

    @Comment("工作流实例名称")
    private String name;

    @Comment("当前节点")
    @ForeignKey(table = WorkFlowNode.class)
    @Constraint(notNull = true)
    private long workFlowNodeId;

    @Comment("流程发起人")
    private String initiator;

    @Comment("实例元数据")
    private JSONObject meta;

    @Comment("实例上下文数据")
    private JSONObject contextData;

    @Comment("实例状态(0:审批中,1:已完成,2:已撤回,3:已拒绝)")
    @Constraint(notNull = true, defaultValue = "0")
    private Integer status;

    @TableField(createdAt = true)
    private LocalDateTime createdAt;

    @TableField(updatedAt = true)
    private LocalDateTime updatedAt;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getDefinitionId() {
        return definitionId;
    }

    public void setDefinitionId(long definitionId) {
        this.definitionId = definitionId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getWorkFlowNodeId() {
        return workFlowNodeId;
    }

    public void setWorkFlowNodeId(long workFlowNodeId) {
        this.workFlowNodeId = workFlowNodeId;
    }

    public String getInitiator() {
        return initiator;
    }

    public void setInitiator(String initiator) {
        this.initiator = initiator;
    }

    public JSONObject getMeta() {
        return meta;
    }

    public void setMeta(JSONObject meta) {
        this.meta = meta;
    }

    public JSONObject getContextData() {
        return contextData;
    }

    public void setContextData(JSONObject contextData) {
        this.contextData = contextData;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }
}
